#include <iostream>

using std::cout;
using std::endl;

class Point {
public:
    Point()=default;//默认构造函数

    Point(int ix, int iy)
    : _ix(ix)
    , _iy(iy)
    {
        //_ix = ix;//error,赋值操作
        //_iy = iy;
    }

    void print() 
    {
        cout << "(" << _ix 
             << "," << _iy
             << ")" << endl;
    }

    void setX(int ix) {
        //_ix = ix;//error
    }

private:
    //const数据成员只能放在初始化列表中进行初始化
    //const数据成员初始化之后，不能再进行修改
    const int _ix = 0;//在声明时直接进行初始化
    const int _iy = 0;
};

int main()
{
    Point pt(10, 11);
    pt.setX(20);
    cout << "pt:";
    pt.print();

    Point pt2;
    cout << "pt2:";
    pt2.print();
    

    return 0;
}

